﻿namespace Chain.Common
{
    using Chain.Common.WebReference;
    using System;
    using System.Runtime.CompilerServices;

    public class SMSHelper
    {
        
        private string _Pwd;
        
        private int _SmsType;
        
        private string _SN;
        private static SmsService SMS = new SmsService();

        public SMSHelper(int smsType, string sn, string pwd)
        {
            this.SmsType = smsType;
            this.SN = sn;
            this.Pwd = pwd;
        }

        public int GetBalance()
        {
            int num = 0;
            try
            {
                num = Convert.ToInt32(SMS.GetBalance(this.SmsType, this.SN, this.Pwd));
            }
            catch
            {
            }
            return num;
        }

        public bool Send_GXSMS(string MobileList, string Content, string Stime)
        {
            long ticks = DateTime.Now.Ticks;
            string str = "";
            str = SMS.SendMessage(this.SmsType, this.SN, this.Pwd, MobileList, Content, Stime);
            new TimeSpan(DateTime.Now.Ticks - ticks);
            return (str.Length > 10);
        }

        public bool Send_SMS(string MobileList, string Content, string Stime)
        {
            long ticks = DateTime.Now.Ticks;
            string str = "";
            str = SMS.SendMessage(this.SmsType, this.SN, this.Pwd, MobileList, Content, Stime);
            new TimeSpan(DateTime.Now.Ticks - ticks);
            return (str.Length > 10);
        }

        private string Pwd
        {
            
            get
            {
                return this._Pwd;
            }
            
            set
            {
                this._Pwd = value;
            }
        }

        private int SmsType
        {
            
            get
            {
                return this._SmsType;
            }
            
            set
            {
                this._SmsType = value;
            }
        }

        private string SN
        {
            
            get
            {
                return this._SN;
            }
            
            set
            {
                this._SN = value;
            }
        }
    }
}

